import {request} from "../../request/index.js"

Page({
  data: {
    userId: '',
    list: [],
    name: '',
    startTime: '',
    endTime: '',
    location: '',
    location1: '',
    show: false
  },
  onLoad(options){
    var userId = options.userId
    request({
      url: '/client/query/plan/' + userId,
      method: 'POST',
      data: {

      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      }
    })
    .then(res => {
      console.log(res)
      this.setData({
        list: res.data
      })
      // var location = ''
      // this.data.list.forEach(item => {
      //   location = item.location
      //   console.log(location)
      // })
      // if(location.length > 10) {
      //   location = location.substring(0, 9) + '...'
      //   this.setData({
      //     location
      //   })
      // } else {
      //   this.setData({
      //     location
      //   })
      // }
    })
  },
  showLocation(e) {
    // this.data.list.forEach((v) => {
      
    //     wx.showModal({
    //       content: v.location
    //     })
      

    // })
    console.log(e)
    wx.showModal({
      title: '',
      content: e.currentTarget.dataset.location,
      // success(res) {
      //   if (res.confirm) {
      //     console.log('用户点击确定')
      //   } else if (res.cancel) {
      //     console.log('用户点击取消')
      //   }
      // }
    })
  }
})                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   